home *** CD-ROM | disk | FTP | other *** search
- This software is NOT freeware, and is distributed under the shareware
- concept, the fee requested for useage of this software is discussed
- at the end of this file (very reasonable).
- It is requested that this archive be distributed as a whole,
- and that all files herein be kept together.
- No fee should be charged for this software beyond actual distribution
- costs (connect fees, diskette costs), and should in no case exceed $10.
-
-
- What you should find in this archive:
-
- ESPOOLER.DOC 17098 bytes This file.
- TP55SPL.TPU 17344 bytes Turbo Pascal 5.5 compatable unit.
- TP50SPL.TPU 18192 bytes Turbo Pascal 5.0 compatable unit.
- SPLTEST.PAS 2443 bytes Sample program using the spooler.
- SPLTEST.EXE 12560 bytes Executable version of same.
-
-
-
- SUMMARY:
- This unit implements a text file device driver (TFDD) called 'SPL'
- which is designed to allow Turbo Pascal 4.0-5.5 programs to dump
- text to the printer as is normally done using the 'LST' TFDD found
- in the 'printer' unit which is part of Turbo Pascal, but
- without arresting the operation of the program entirely until the
- printing is finished. It has been tested with Espon LX/MX/FX
- printers. By default it uses only a 16K main memory buffer, which
- should be fine for most text documents of 3 pages. If you try and
- dump more than that at a time you'll have to wait. Alternatively you
- can expand the main memory spooler buffer up to 65521 bytes. If you
- have Expanded, or Extended memory on your computer, and the appropriate
- memory manager you can install a spooler in EMS or XMS. It can be any
- size from 16K up to all of your EMS/XMS memory, at your discretion.
-
-
- As indicated above there are actually 4 modes in which the spooler can
- operate:
-
- 1) The default, put the spooler buffer in main memory on the Turbo
- Pascal heap. This spooler buffer can be any size between 16384 bytes
- and 65521 bytes (the largest single object that can be allocated on
- the TP heap).
-
- 2) If expanded memory is available, and a LIM 3.X compatible memory
- manager which supports data aliasing is loaded, then a spooler buffer
- between 16K and all the available expanded memory can be set up.
-
- 3) If extended memory is available, and an XMS 2.0 compatible memory
- manager (like HIMEM.SYS from Microsoft, or some versions QEMM-386
- from Quarterdeck, and 386^MAX from Qualitas) then a spooler buffer
- of between 16K and all the available extended memory can be set up.
-
- 4) If expanded and extended memory are not available, and regular
- memory is scarce, then the spooler can be directed to dump
- characters directly to the printer, as is normally done when
- writing to Turbo Pascal's LST printer device.
-
- It should be noted that first pausing the spooler's printing out and
- then overflowing the spooler buffer will likely lock up the system,
- so if you pause the spooler, don't feed it any more text.
-
- If a print screen is in progress then this spooler will wait until it's
- finished before accepting any characters to print. So DO NOT set
- the printscr bit or the system will lock up. Also printscr is disabled
- while the spooler has characters in it's buffer.
-
- This unit opens the printer in non-text file mode, this allows values of
- 26 to be sent to the printer. When the printer is opened with the
- normal text file driver, all 26's (End of File marker's in DOS) are
- automatically stripped off. If we are dumping graphics, for example,
- then this is obviously undesireable.
-
- This software does data aliasing when using expanded memory, and therefore
- may not function with some types of software-only expanded memory
- emulators. (It should work on all 80386 specific expanded memory
- emulators.) This unit does however test for this capability and will
- simply refuse to install the spooler in EMS if this capability is not
- supported. No function specific to the LIM 4.0 specification are used
- so it should work with any LIM 3.X compatible memory manager.
-
- When using extended memory this software does not use the High Memory Area
- which is available on many 80286 & 80386 based computers with more than
- 640K of memory. It instead requires the availability of Extended Memory
- Blocks which are beyond the HMA. If EMB's are not supported the spooler
- will refuse to load in extended memory. This will return an I/O error
- which can be trapped in the usual way. Note: 8K of heap space is used
- for a swap area when spooling in XMS.
-
- Sample useage:
-
- Writeln(SPL,'This is a test string.');
- Writeln(SPL,'This is a combo of variables',Variable,' and strings.');
- Writeln(SPL,#10#10,'This will give a couple of extra linefeeds.');
-
- ----------------------------------------------------------------------------
-
- The externally visible procedures comprising this unit are:
-
- 'SETPRINTER' - Allows you to change which printer the spooler will
- send characters to, the default is LPT1. To change to LPT2:
-
- SetPrinter(2);
-
-
- 'ALTERSPOOLERSIZE' - Allows you to change the default 16k spooler size.
- This function has no effect unless the spooler device is closed. To
- change the spooler size to 32k:
-
- Close(SPL); (* close spooler *)
- AlterSpoolerSize(32768); (* increase spooler size *)
- Rewrite(SPL); (* reopen spooler *)
-
-
- 'SPOOLFUNCS' - Allows the program to directly manupulate the workings
- of the spooler. It accepts an integer corresponding to the desired
- function.
- 1: Clear the spooler. This clears the contents of the spooling
- queue, and stops the printing.
- 2: Pause the spooler. This clauses the spooler to stop printing until
- the 'Resume' function (function 3) is used. This may be useful if
- you are doing something that is time critical and/or should not be
- interrupted until finished. This has no effect if the spooling
- is disabled (ie., printing directly to the printer).
- 3: Resume printing. This cancels the pause caused by function 2.
-
-
- 'SPOOLERSTATUS' - Allows the program to query the status of the spooler.
- Using the 'SplStatType' declared in this unit's interface section,
- the current size of the spooler can be determined (a size of 0
- indicating either that the spooler is closed, or that the spooler
- is operating in the direct to printer mode (see description of
- operational modes and how to change them below). The number of bytes
- left in the spooler buffer to print can be ascertained. Finally whether
- the spooler is currently paused or not can be determined. Also what
- mode the spooler is operating in can be determined.
- NOTE: The correct mode will be returned only if the spooler is open
- when this procedure is called.
-
- 'SET_SPOOLER_PRIORITY' - Changes the speed at which characters are dumped
- out the parallel port. The default priority, 0, sends about 50
- characters a second to the parallel port and uses about 6-9% of the
- CPU's clock cycles, this is Ok for most line printers. The highest
- priority, 10, sends about 200 characters a second to the parallel
- port, and consumes about 18-21% of the CPU's clock cycles, this
- highest priority will only have a visible effect on printers with
- large internal print buffers, like laser printers.
-
- The following four procedures/functions change the operating mode of
- the spooler. The spooler device which is by default open, must be closed
- for any of the following to have any effect.
-
- 'DIRECT_TO_PRINTER' - Changes the mode in which the spooler will be opened
- from the current mode, to direct to printer output. This Procedure
- will have no effect if the spooler device is not closed.
- EXAMPLE : If for some reason you don't want the spooler taking up main
- memory, ie., you need every byte of heap space you can get your hands
- on. You can close the spooler down, change the spooler to direct to
- printer operation, and reopen it:
-
- Close(SPL);
- Direct_To_Printer;
- Rewrite(SPL);
-
- This will deallocate the spooler buffer, and cause any characters
- sent to the spooler to go straight to the printer instead of into the
- spooler buffer. ie., calling:
-
- Writeln(SPL,' ..... ');
-
- will have the same effect as:
-
- Writeln(LST,' ..... ');
-
-
- 'SPOOL_IN_EMS' - Changes the mode in which the spooler will be opened
- from the current mode to spooling in expanded memory. It also specifies
- the size of the expanded memory buffer desired. This function checks
- to see if there is an expanded memory manager loaded, if that EMM
- supports data aliasing, and if enough expanded memory exists to support
- the request. If these conditions are met, then 0 is returned, otherwise
- a value of 1 is returned, and the previously assigned spooler mode
- remains operational. The EMS useage in this program saves and restores
- the condition of the expanded memory manager before and after use, so it
- should be compatable with programs that use EMS for other purposes.
- This function will fail if the spooler device is not closed.
- NOTE: Spooler size is rounded up to the next largest 16K block size.
- EXAMPLE: I want to allocate a 32K spooler buffer in EMS:
-
- Close(SPL);
- IF Spool_In_EMS(32768) = 0 THEN
- Rewrite(SPL);
-
- 'SPOOL_IN_XMS' - Changes the mode in which the spooler will be opened
- from the current mode to spooling in extended memory. It also specifies
- the size of the extended memory buffer desired. This function checks
- to see if there is an extended memory manager loaded, if that XMM
- supports Extended Memory Blocks, and if enough expanded memory exists
- to support the request. If these conditions are met, then 0 is returned,
- otherwise a value of 1 is returned, and the previously assigned spooler
- mode remains operational. This function will fail if the spooler device
- is not closed.
- NOTE: Spooler size is rounded up to the next largest 4K block size, with
- a minimum of 16K.
- EXAMPLE: I want to allocate a 32K spooler buffer in XMS:
-
- Close(SPL);
- IF Spool_In_XMS(32768) = 0 THEN
- Rewrite(SPL);
-
-
- 'SPOOL_IN_MEMORY' - Changes the mode in which the spooler will be opened
- from the current mode to spooling in main memory. As indicated above
- this procedure will have no effect if the spooler device is not closed.
-
-
-
- ERROR Conditions:
- If, when your program starts the spooler is printing direct to printer
- then the spooler was unable to install itself normally. What is
- done in this case is any output normally directed through the spooler
- is printed directly to the printer instead, as in "Direct_To_Printer".
- Possible causes of this are:
- 1) There was insufficient heap space to install the default spooler.
- If EMS is available you may still allocate an EMS buffer and
- run in that fashion. The remedies are : Free up some heap space,
- or put the spooler in EMS or XMS.
- 2) More critical, a key DOS flag could not be located, and it was
- unsafe to install the spooler. There is no remedy for this.
- Further attempts to open the spooler in any other mode will result
- in an error condition. This should not happen.
-
-
- There are a number of cases where the calling one of the associated
- spooler functions (Rewrite,Writeln,Write) can cause an error condition.
- If you compile with I/O error checking off you'll be able to trap
- these and prevent program termination.
- Possible return codes which can occur are:
-
- Writeln,Write :
- 160 : Out of paper, Device write fault.
-
- Rewrite:
- 1 : Failure allocating EMS or XMS spooler.
- ( Only if you try to allocate the EMS or XMS spooler. )
- 203 : If the spooler cannot allocate memory for it's buffer.
- ( Heap either too small or fragmented, main memory spooler. )
-
-
-
-
-
- The following is the interface for the spooler unit.
- To compile this unit for Turbo Pascal 4.0 you will have to remove some
- of the compiler directives which do not exist in TP 4.0.
-
- {$A+,R-,S+,I+,D+,F-,V-,B-,N-,E-,L+,O-}
-
- {--------------------------------------------------------------------}
- {---------------------------} INTERFACE {----------------------------}
- {--------------------------------------------------------------------}
-
- uses CRT,DOS;
-
- CONST
- SplClear = 1; { Clear the spooler. }
- SplPause = 2; { Pause the spooler's printing. }
- SplResume = 3; { Resume spooler printing. }
-
- TYPE
- SpoolWhereType = (DirectTOPrinter,InHeap,InEMS,InXMS);
- SplStatType = RECORD
- SplSize : Longint;
- BytesToPrint : Longint;
- Paused : BOOLEAN;
- SpoolWhere : SpoolWhereType;
- END;
-
-
- VAR
- SPL : TEXT; { New text file. }
-
- Procedure SpoolFuncs(Operation : Integer);
- Procedure SpoolerStatus(VAR Spoolstat : SplStatType);
- Procedure SetPrinter(Port : BYTE); { Change the printer spl sends to. }
- Procedure AlterSpoolerSize(Size : LongInt);
- Procedure Set_Spooler_Priority(NewPriority : WORD);
-
- Procedure Direct_To_Printer; { Select Mode of Spooler. }
- Function Spool_In_EMS(Size : LongInt):Integer;
- Procedure Spool_In_Memory;
- Function Spool_In_XMS(Size : LongInt): Integer;
-
-
- { END of interface }
-
-
-
-
- MORAL DOGMA
- ___________
-
- If you like this programming unit and find it useful, you are requested
- to support it's continued development, and the development of other
- useful programming tools for serious pascal developers by sending $10
- to the address below. In addition to peace of mind, for your $10 you'll
- get the right to use this unit in your programs royalty free. Please
- send international/postal money orders or a check drawn on a Canadian bank.
- If you think you'd like to customize this unit for your application, if
- you send $30 (and specify media preference) I'll send you all current
- source code.
-
- Whether you decide to pony up this minor utilization fee or not, the
- author would appreciate any bug reports or suggestions that may
- be forthcoming.
-
-
- Douglas Webb
- 228 Murray St.
- Montreal, Quebec
- H3C 2C7
- CANADA
-
-
- LEGAL DOGMA
- ___________
-
-
- Douglas Webb (hereafter refered to as 'the author') hereby disclaims all
- warranties relating to this software, whether express or implied,
- including without limitation any implied warranties of merchantability
- or fitness for a particular purpose. The author will not be liable
- for any special, incidental, consequential, indirect or similar damages
- due to loss of data or any other reason, even if the author has been
- advised of the possibility of such damages. The person using the software
- bears all risk as to the quality and performance of the software.
-
- The author has done his very best to make sure that everything stated
- in above documentation is correct. However, the author assumes no
- responsibility for errors that may appear in the descriptions of this
- software (although he would like to hear about them).
-
-
-
- Turbo Pascal is a trademark of Borland International.
- QEMM-386 is a trademark of QuarterDeck Office Systems.
- 386^Max is a trademark of Qualitas Inc.
-
-
-
- HISTORY
- -------
- Version 1.0
- - ESPOOLER is sprung on an unsuspecting world.
-
- Version 1.01
- - Minor printing speed improvement.
-
- - Fixed bug which didn't allow you to close the spooler without turning
- the printer on. This is real annoying if you don't have a printer
- attached.
-
- - Fixed bug in 'SPOOLERSTATUS' which caused divide by zero error when in
- 'Direct_To_Printer' mode.
-
- - Added code to allow a program using the spooler to load even if either:
- a) There was insufficient heap for the default spooler buffer.
- b) The spooler couldn't find the DOS CriticalStatus flag.
-
- Version 1.1
- - added the ability to use XMS
-
- - added run-time customizable priority setting which affects printing
- speed (useful for high speed printers).
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- Public (software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. PsL cannot debug pro-
- programs over the telephone, though we can answer questions.
-
- Disks in the PsL are updated monthly, so if you did not get
- this disk directly from the PsL, you should be aware that the
- files in this set may no longer be the current versions. Also,
- if you got this disk from another vendor and are having prob-
- lems, be aware that some files may have become corrupted or
- lost by that vendor. Get a current, working disk from PsL.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 2,000+ disks in the library, call or write
-
- Public (software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
-
- 1-800-2424-PSL
- MC/Visa/AmEx/Discover
-
- Outside of U.S. or in Texas
- or for general information,
- Call 1-713-524-6394
-
- PsL also has an outstanding
- catalog for the Macintosh.
-